package com.smartleanx.module.hrm.eums.employee;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum SeparationReasonEnum {
    FAMILY_REASONS(1, "家庭原因"),
    PHYSICAL_REASONS(2, "身体原因"),
    SALARY_REASONS(3, "薪资原因"),
    INCONVENIENT_TRANSPORTATION(4, "交通不便"),
    WORKING_PRESSURE(5, "工作压力"),
    MANAGEMENT_PROBLEM (6, "管理问题"),
    NO_PROMOTION_OPPORTUNITIES(7, "无晋升机会"),
    CAREER_PLANNING(8, "职业规划"),
    WAIVER_OF_RENEWAL(9, "合同到期放弃续签"),
    OTHER_REASONS(10, "以其他个人原因离职"),
    ;

    private final Integer code;

    private final String desc;

    SeparationReasonEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据code返回desc
     *
     * @param code 编号
     * @return 名称
     */
    public static String getDesc(Integer code) {
        for (SeparationReasonEnum e : SeparationReasonEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }
}
